﻿using QQExpression.Utils.Currency;
using System;
using System.Collections.Generic;
using System.Net;

namespace QQExpression.Utils.Helper
{
    class StaticValue
    {
        /*
         ViewHelper
         */
        public static bool ComboxShowFlag = false;
        private static bool printFlag = true;
        private static string tempPath = ".\\TempPath\\";
        private static string downloadPath =TempPath+ "Download\\";

        private static string binPath = ".\\Bin\\";
      
        private static string oldLogFloderPath=tempPath+"OldLog\\";
        private static string printLogPath = TempPath + "Runlog.txt";

        private static List<String> runlogList = FileHelper.ReadAllLine(PrintLogPath);
        //下载文件的辅助
        private static string ImgTemp = TempPath + "DownloadImg\\";
        private static string userAgent = "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.94 Safari/537.36";
        private static string moblieUserAgent = "Mozilla/5.0 (Linux; Android 7.0; PLUS Build/NRD90M) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.98 Mobile Safari/537.36";

  
        /* 屏蔽关键词*/

        private static string excludePath = BinPath + "ExcludeKey.txt";
        private static List<string> excludeList =ListHelper.ListRepeat(FileHelper.ReadAllLine(ExcludePath));
        //到此结束
        /*
         * groupbox 大小控制**/
        private static int groupboxWidth = 825;
        private static int groupboxHeight =419;

        /// <summary>
        /// 基础header
        /// </summary>
        /// <param name="FileUrl"></param>
        /// <returns></returns>
        public static WebHeaderCollection CurrencyWebHeader()
        {
            WebHeaderCollection webHeaderCollection = new WebHeaderCollection();
            webHeaderCollection.Add("User-Agent", UserAgent);
            webHeaderCollection.Add("Accept-Language", "zh-TW,zh;q=0.8,en-US;q=0.5,en;q=0.3");
            return webHeaderCollection;
        }
        /// <summary>
        /// 通用获取webheader类
        /// </summary>
        /// <param name="FileUrl"></param>
        /// <returns></returns>
        public static WebHeaderCollection CurrencyWebHeader(String FileUrl)
        {
            WebHeaderCollection webHeaderCollection = CurrencyWebHeader();
            String GetHost = "";
            try
            {
                GetHost = new Uri(FileUrl).Host;
                webHeaderCollection.Add("Host", GetHost);
            }
            catch (Exception ex)
            {
                PrintLog.Log(ex);
            }
        
            return webHeaderCollection;

        }

    public    class PostInfo
        {
            string Title;
            string Content;

            public string Title1 { get => Title; set => Title = value; }
            public string Content1 { get => Content; set => Content = value; }
        }
        /// <summary>
        /// 控制日志写入的flag
        /// </summary>
        public static bool PrintFlag { get => printFlag; set => printFlag = value; }
      
        /// <summary>
        /// 缓存路径
        /// </summary>
        public static string TempPath { get => tempPath; set => tempPath = value; }
       
        public static string BinPath { get => binPath; set => binPath = value; }
      
        public static string PrintLogPath { get => printLogPath; set => printLogPath = value; }
        public static string ImgTemp1 { get => ImgTemp; set => ImgTemp = value; }
        public static string UserAgent { get => userAgent; set => userAgent = value; }
        public static string MoblieUserAgent { get => moblieUserAgent; set => moblieUserAgent = value; }
        /// <summary>
        /// 下载文件夹
        /// </summary>
        public static string DownloadPath { get => downloadPath; set => downloadPath = value; }
        /// <summary>
        /// 放置旧的LOG
        /// </summary>
        public static string OldLogPath { get => oldLogFloderPath; set => oldLogFloderPath = value; }

        /// <summary>
        /// 控制界面微调 宽度
        /// </summary>
        public static int GroupboxWidth { get => groupboxWidth; set => groupboxWidth = value; }
        /// <summary>
        /// 控制界面微调 高度
        /// </summary>
        public static int GroupboxHeight { get => groupboxHeight; set => groupboxHeight = value; }
       
        /// <summary>
        /// 屏蔽关键词的路径
        /// </summary>
        public static string ExcludePath { get => excludePath; set => excludePath = value; }
        /// <summary>
        /// 屏蔽关键词列表
        /// </summary>
        public static List<string> ExcludeList { get => excludeList; set => excludeList = value; }
        /// <summary>
        /// 日志列表
        /// </summary>
        public static List<string> RunlogList { get => runlogList; set => runlogList = value; }
    }
}
